home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sources / libxpm / libxpm34.gz / libxpm34 / xpm-3.4 / lib / XpmRdFToData.c < prev    next >
C/C++ Source or Header  |  1994-03-14  |  1KB  |  42 lines

  1. /* Copyright 1989-94 GROUPE BULL -- See license conditions in file COPYRIGHT */
  2. /*****************************************************************************\
  3. * XpmRdFToData.c:                                                             *
  4. *                                                                             *
  5. *  XPM library                                                                *
  6. *  Parse an XPM file and create an array of strings corresponding to it.      *
  7. *                                                                             *
  8. *  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
  9. \*****************************************************************************/
  10.  
  11. #include "xpmP.h"
  12.  
  13. int
  14. XpmReadFileToData(filename, data_return)
  15.     char *filename;
  16.     char ***data_return;
  17. {
  18.     XpmImage image;
  19.     XpmInfo info;
  20.     int ErrorStatus;
  21.  
  22.     info.valuemask = XpmReturnComments | XpmReturnExtensions;
  23.  
  24.     /*
  25.      * initialize return value
  26.      */
  27.     if (data_return)
  28.     *data_return = NULL;
  29.  
  30.     ErrorStatus = XpmReadFileToXpmImage(filename, &image, &info);
  31.     if (ErrorStatus != XpmSuccess)
  32.     return (ErrorStatus);
  33.  
  34.     ErrorStatus =
  35.     XpmCreateDataFromXpmImage(data_return, &image, &info);
  36.  
  37.     XpmFreeXpmImage(&image);
  38.     XpmFreeXpmInfo(&info);
  39.  
  40.     return (ErrorStatus);
  41. }
  42.